package com.csy.service.impl;

import com.csy.service.HomeworkService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;

@Service
public class HomeworkServiceImpl  implements HomeworkService {
    @Override
    public String methodA() throws InterruptedException {
        Random random = new Random();

        // 返回0 to x的一个随机数但不会取到x，即返回[0,x)闭开区间的值。
        int num = random.nextInt(100);
        Thread.sleep((long)num);
        return "methodA：休眠"+num+"毫秒";
    }

    @Override
    public String methodB() throws InterruptedException {
        Random random = new Random();

        // 返回0 to x的一个随机数但不会取到x，即返回[0,x)闭开区间的值。
        int num = random.nextInt(100);
        Thread.sleep((long)num);
        return "methodB：休眠"+num+"毫秒";
    }

    @Override
    public String methodC() throws InterruptedException {
        Random random = new Random();

        // 返回0 to x的一个随机数但不会取到x，即返回[0,x)闭开区间的值。
        int num = random.nextInt(100);
        Thread.sleep((long)num);
        return "methodC：休眠"+num+"毫秒";
    }
}
